package cn.project.engineering.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class WonderSp {


    public static  void putDataNomal(Context context,String key,String value){
        //步骤1：创建一个SharedPreferences对象
        SharedPreferences sharedPreferences= context.getSharedPreferences("data", Context.MODE_PRIVATE);
        //步骤2： 实例化SharedPreferences.Editor对象
        SharedPreferences.Editor editor = sharedPreferences.edit();
        //步骤3：将获取过来的值放入文件
        editor.putString(key, value);
        //步骤4：提交
        editor.commit();
    }
    public static  String getDataNomal(Context context,String key){
        SharedPreferences sharedPreferences=context.getSharedPreferences("data", Context .MODE_PRIVATE);
        return sharedPreferences.getString(key,"");
    }



    public static  void setData(Context context,int statue){
        //步骤1：创建一个SharedPreferences对象
        SharedPreferences sharedPreferences= context.getSharedPreferences("data", Context.MODE_PRIVATE);
        //步骤2： 实例化SharedPreferences.Editor对象
        SharedPreferences.Editor editor = sharedPreferences.edit();
        //步骤3：将获取过来的值放入文件
        editor.putInt("closestatue", statue);
        //步骤4：提交
        editor.commit();
    }


    public static  int getData(Context context){
        SharedPreferences sharedPreferences=context.getSharedPreferences("data", Context .MODE_PRIVATE);
        return sharedPreferences.getInt("closestatue",0);
    }


    public static  void setDataSop(Context context,int statue){
        //步骤1：创建一个SharedPreferences对象
        SharedPreferences sharedPreferences= context.getSharedPreferences("data", Context.MODE_PRIVATE);
        //步骤2： 实例化SharedPreferences.Editor对象
        SharedPreferences.Editor editor = sharedPreferences.edit();
        //步骤3：将获取过来的值放入文件
        editor.putInt("issop", statue);
        //步骤4：提交
        editor.commit();
    }


    public static  int getDataSop(Context context){
        SharedPreferences sharedPreferences=context.getSharedPreferences("data", Context.MODE_PRIVATE);
        return sharedPreferences.getInt("issop",0);
    }


    public static  void setDataDownState(Context context,int statue){
        //步骤1：创建一个SharedPreferences对象
        SharedPreferences sharedPreferences= context.getSharedPreferences("data", Context.MODE_PRIVATE);
        //步骤2： 实例化SharedPreferences.Editor对象
        SharedPreferences.Editor editor = sharedPreferences.edit();
        //步骤3：将获取过来的值放入文件
        editor.putInt("downpk", statue);
        //步骤4：提交
        editor.commit();
    }

    public static  int getDataDownState(Context context){
        SharedPreferences sharedPreferences=context.getSharedPreferences("data", Context .MODE_PRIVATE);
        return sharedPreferences.getInt("downpk",0);
    }

}
